﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Vinetlife.Master" AutoEventWireup="true"
    CodeBehind="OrderHistory.aspx.cs" Inherits="VINETLIFE.Customers.OrderHistory" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="/Module/ucVnLeftCustomerMenu.ascx" TagName="ucVnLeftCustomerMenu"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="main-container-inner">
        <div class="main-container-inner">
            <div id="breadcrumb">
                <ul class="crumbs">
                    <li class="first"><a href="/" style="z-index: 9;" title="Trang chủ"><span></span>Trang
                        chủ</a></li>
                    <li><a href="/trang-ca-nhan/" style="z-index: 8;">Trang cá nhân</a></li>
                    <li><a href="#" style="z-index: 7;">Lịch sử mua hàng</a></li>
                </ul>
            </div>
            <div class="t-content-wrap">
                <div class="main-container-inner-left">
                    <uc1:ucVnLeftCustomerMenu ID="ucVnLeftCustomerMenu1" runat="server" />
                </div>
                <div class="main-container-inner-right">
                    <%-- <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>--%>
                    <h4>Lịch sử mua hàng</h4>
                    <div class="tranhis-search-wrap">
                        <div class="tranhis-search-inner-right">
                            <div class="tranhis-search-inner-type">
                                <span class="tranhis-lable-content">Tìm kiếm</span>
                            </div>
                            <div class="tranhis-search-inner-date">
                                <table class="tranhis-table">
                                    <tr>
                                        <td class="tranhist-tdl">
                                            <span class="tranhis-lable-content">Chọn thời gian        
                                            </span>
                                            <span class="tranhis-lable-contentr">
                                                <asp:RadioButton runat="server" ID="rdSearchDate" GroupName="grpPurchase" Text="Ngày chính xác" Checked="true" />
                                                <asp:RadioButton runat="server" ID="rdFromDate" GroupName="grpPurchase" Text="Khoảng thời gian" />
                                            </span>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div class="tranhis-search-inner-date">
                                <table class="tranhis-table">
                                    <tr>
                                        <td class="tranhist-tdr">
                                            <div id="dthsearchdate" class="dth-searchdate">
                                                <span class="tranhis-lable-date">Chọn ngày</span>
                                                <asp:TextBox runat="server" ID="txtSearchDate" CssClass="dth-input"></asp:TextBox>
                                                <cc1:CalendarExtender runat="server" ID="X" TargetControlID="txtSearchDate" Format="dd/MM/yyyy"></cc1:CalendarExtender>
                                            </div>
                                            <div id="dthfromdate" style="display: none;" class="dth-searchdate">
                                                <div class="dth-search-from-date">
                                                    <span class="tranhis-lable-date">Từ ngày</span>
                                                    <asp:TextBox runat="server" ID="txtFromDate" CssClass="dth-input" Width="100px"></asp:TextBox>
                                                    <cc1:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="txtFromDate" Format="dd/MM/yyyy"></cc1:CalendarExtender>
                                                </div>
                                                <div class="dth-search-to-date">
                                                    <span class="tranhis-lable-date">Tới ngày</span>
                                                    <asp:TextBox runat="server" ID="txtToDate" CssClass="dth-input" Width="100px"></asp:TextBox>
                                                    <cc1:CalendarExtender runat="server" ID="CalendarExtender2" TargetControlID="txtToDate" Format="dd/MM/yyyy"></cc1:CalendarExtender>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                    </tr>
                                </table>
                            </div>
                            <div class="tranhis-search-inner-search">
                                <asp:Button runat="server" ID="btnSearch" Style="float: right;" Text="Tìm kiếm" OnClick="btnSearch_Click"  CssClass="btnLogin" />
                            </div>
                        </div>
                    </div>
                    <div id="gridview">
                        <asp:GridView ID="gridView" runat="server" CssClass="tstyle1" Width="100%" AutoGenerateColumns="False"
                            CellPadding="3" EnableModelValidation="True" GridLines="None" AllowPaging="True"
                            BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellSpacing="1"
                            PageSize="10" OnRowDataBound="gridView_RowDataBound" OnPageIndexChanging="gridView_PageIndexChanging"
                            EmptyDataText="Dữ liệu trống !" OnRowCommand="gridView_RowCommand">
                            <Columns>
                                <asp:TemplateField HeaderText="#" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <%# Container.DataItemIndex+1 %>
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="InvoiceNumber" HeaderText="Mã hóa đơn">
                                    <ItemStyle Width="100px" />
                                </asp:BoundField>

                                <asp:TemplateField HeaderText="Ngày đặt">
                                    <ItemTemplate>
                                        <asp:Label ID="lblDateStart" runat="server" Text='<%#Eval("DateOfStart", "{0:dd/MM/yyyy}")%>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="100px" HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="PaymentText" HeaderText="Hình thức thanh toán">
                                    <ItemStyle Width="150px" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="Tình trạng">
                                    <ItemTemplate>
                                        <asp:Label ID="lblStatus" runat="server" Text='<%#TransactionOrderStatus(Eval("Id").ToString())%>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="150px" HorizontalAlign="Left" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Tổng tiền">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTotal" runat="server" Text='<%#Eval("GrandTotal","{0:0,##} đ")%>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="100px" HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Xem" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="50px">
                                    <ItemTemplate>

                                        <asp:Button runat="server" ID="btnView" CommandName="vieworder" CommandArgument='<%#Eval("Id") %>' CssClass="btnView" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="50px">
                                    <ItemTemplate>

                                        <asp:Button runat="server" ID="btnCancelOrder" Enabled="false" CommandName="cancelorder" CommandArgument='<%#Eval("Id") %>' Text="Hủy" CssClass="button-gg-green" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                            <ProgressTemplate>
                                <img src="../../Images/ajax-loader.gif" alt="Loadding" style="position: absolute; top: 50%; left: 50%; z-index: 1000" />
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                    </div>
                    <div style="margin: 10px 0px">
                        <label style="font-weight:bold;color:#333;font-size:12px;">
                            Số dòng hiển thị trên 1 trang :
                        </label>
                        <asp:DropDownList runat="server" ID="dropPageSize" CssClass="dropdown" AutoPostBack="true"
                            OnSelectedIndexChanged="dropCountRow_SelectedIndexChanged">
                            <asp:ListItem Text=" 10 " Value="10" Selected="True" />
                            <asp:ListItem Text=" 20 " Value="20" />
                            <asp:ListItem Text=" 30 " Value="30" />
                            <asp:ListItem Text=" 50 " Value="50" />
                            <asp:ListItem Text=" 100 " Value="100" />
                        </asp:DropDownList>
                    </div>

                    <div id="details" runat="server" visible="false" class="t-orderhistory-detail-box">
                        <p>
                            Chi tiết đơn hàng:
                            <asp:Label runat="server" ID="lblInvoiceNumber"></asp:Label>
                        </p>
                        <asp:GridView ID="listDetail" runat="server" CssClass="tstyle1" Width="100%" AutoGenerateColumns="False"
                            CellPadding="3" EnableModelValidation="True" GridLines="None" AllowPaging="True"
                            BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellSpacing="1"
                            PageSize="8" EmptyDataText="Dữ liệu trống !">
                            <Columns>
                                <asp:TemplateField HeaderText="#" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <%# Container.DataItemIndex+1 %>
                                    </ItemTemplate>
                                    <ItemStyle Width="5px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Mã SP">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCode" runat="server" Text='<%#Eval("ProductCode")%>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="15px" HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Tên SP">
                                    <ItemTemplate>
                                        <asp:Label ID="lblName" runat="server" Text='<%#Eval("ProductTitle")%>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="60px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Số lượng">
                                    <ItemTemplate>
                                        <asp:Label ID="lblQty" runat="server" Text='<%#Eval("Qty")%>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="10px" HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Đơn giá">
                                    <ItemTemplate>
                                        <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("Price","{0:0,0 VNĐ}")%>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="15px" HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Thành tiền">
                                    <ItemTemplate>
                                        <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("TotalMoney","{0:0,0 VNĐ}")%>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle Width="20px" HorizontalAlign="Center" />
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </div>
                    <div style="margin-top: 10px">
                        <asp:Literal ID="lbThongBao" runat="server" />
                    </div>
                    <%--  </ContentTemplate>
                    </asp:UpdatePanel>--%>
                </div>
            </div>
        </div>
    </div>
     <script type="text/javascript">

         $(window).load(function () {
             
            var searchDate =  $('[id$=rdSearchDate]').is(':checked');
            var fromDate = $('[id$=rdFromDate]').is(':checked');



            if (searchDate) {
                 $('#dthsearchdate').css('display', 'block');
                 $('#dthfromdate').css('display', 'none');
             }

            if (fromDate) {
                 $('#dthsearchdate').css('display', 'none');
                 $('#dthfromdate').css('display', 'block');
             }
         });
   </script>
</asp:Content>
